﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Data.Linq.Mapping;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Phone.Data.Linq.Mapping;

/**
 * 创建时间：2014/12/19 11:29:57
 * 作者：yong.blackcore
 * Email：itblackhole@outlook.com
 * QQ：50404503
 */
namespace ComicIsland.Common.Entities.ComicDatabase
{
    [Table]
    public class DbChapter 
    {
        /// <summary>
        /// 版本列，可以显著改进表的更新性能
        /// </summary>
        [Column(IsVersion = true)]
        private Binary _version;

        [Column(DbType = "INT NOT NULL IDENTITY", IsDbGenerated = true, IsPrimaryKey = true)]
        public int Id { get; set; }

        [Column]
        public int ComicId { get; set; }

        [Column]
        public string ComicIdAndPartId { get; set; }

        [Column]
        public string Sourceparturl { get; set; }
        [Column]
        public string Msourceparturl { get; set; }
        [Column]
        public double Partsize { get; set; }
        [Column]
        public int PartId { get; set; }

        [Column]
        public int Partnumber { get; set; }

        [Column]
        public string Name { get; set; }

        [Column]
        public int Totalpage { get; set; }

        [Column]
        public string DownloadStatus { get; set; }

        public override string ToString()
        {
            StringBuilder content = new StringBuilder();
            content.Append(string.Concat("_version", ":", this._version, ","));
            content.Append(string.Concat("Id", ":", this.Id, ","));
            content.Append(string.Concat("ComicIdAndPartId", ":", this.ComicIdAndPartId, ","));
            //
            content.Append(string.Concat("PartId", ":", this.PartId, ","));
            content.Append(string.Concat("Partnumber", ":", this.Partnumber, ","));
            content.Append(string.Concat("Partsize", ":", this.Partsize, ","));
            content.Append(string.Concat("Name", ":", this.Name, ","));
            content.Append(string.Concat("Msourceparturl", ":", this.Msourceparturl, ","));
            content.Append(string.Concat("Sourceparturl", ":", this.Sourceparturl, ","));
            content.Append(string.Concat("Totalpage", ":", this.Totalpage, ","));
            content.Append(string.Concat("DownloadStatus", ":", this.DownloadStatus, ","));
            //
            return content.ToString();
        }
    }
}
